package com.whpost.service.dao.addr;


import com.whpost.service.entity.addr.TWxCity;
import com.whpost.service.entity.addr.TWxCounty;
import com.whpost.service.entity.addr.TWxProvince;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yinzhuoyi
 * @since 2020-05-21
 */
@Mapper
public interface TWxAddrDao {

    //省
    @Select("select * from t_wx_province where lsh=#{0}")
    TWxProvince getProv(Long lsh);

    //省
    @Select("select * from t_wx_province where name=#{0}")
    TWxProvince getProvByName(String ProName);

    //市
    @Select("select * from t_wx_city where lsh=#{0}")
    TWxCity getCity(Long lsh);

    //市
    @Select("select * from t_wx_city where name=#{0}")
    TWxCity getCityByName(String cityName);

    //县区
    @Select("select * from t_wx_county where lsh=#{0}")
    TWxCounty getCounty(Long lsh);

    //省流水号
    @Select("select lsh from t_wx_province where province_id=#{0}")
    Long getProvLsh(String id);

    //市流水号
    @Select("select lsh from t_wx_city where city_id=#{0}")
    Long getCityLsh(String id);

    //县区流水号
    @Select("select lsh from t_wx_county where county_id=#{0}")
    Long getCountyLsh(String id);

    //省名称
    @Select("select name from t_wx_province where lsh=#{0}")
    String getProvName(String id);

    //市名称
    @Select("select name from t_wx_city where lsh=#{0}")
    String getCityName(String id);

    //县区名称
    @Select("select name from t_wx_county where lsh=#{0}")
    String getCountyName(String id);

    //获取所有省
    @Select("select * from t_wx_province where address_area_id=#{0}")
    List<TWxProvince> getProvL(Long addressAreaId);

    //根据省份获取城市
    @Select("select * from t_wx_city where province_id=#{0}")
    List<TWxCity> getCityLByProv(String provinceId);

    //根据城市获取县区
    @Select("select * from t_wx_county where city_id=#{0}")
    List<TWxCounty> getCountyLByCity(String cityId);

}
